$(document).ready(
		function() {
			// this will get the full URL at the address bar
			var url = window.location.href;

			// passes on every "a" tag
			$(".main-menu a").each(function() {
				// checks if its the same on the address bar
				if (url == (this.href)) {
					$(this).closest("li").addClass("active");
					$(this).parents('li').addClass('parent-active');
				}
			});

			// NUMBERS COUNTER START
			$('.numbers').data(
					'countToOptions',
					{
						formatter : function(value, options) {
							return value.toFixed(options.decimals).replace(
									/\B(?=(?:\d{3})+(?!\d))/g, ',');
						}
					});

			// start timer
			$('.timer').each(count);

			function count(options) {
				var $this = $(this);
				options = $.extend({}, options || {}, $this
						.data('countToOptions')
						|| {});
				$this.countTo(options);
			} // NUMBERS COUNTER END

			//var tpj = $;
			//tpj.noConflict();

			$(document).ready(function() {

				if ($.fn.cssOriginal != undefined)
					$.fn.css = $.fn.cssOriginal;

				$('.banner').revolution({
					delay : 9000,
					startheight : 500,
					startwidth : 1200,

					hideThumbs : 200,

					thumbWidth : 100, // Thumb With and Height and Amount
										// (only if navigation Tyope set to
										// thumb !)
					thumbHeight : 50,
					thumbAmount : 5,

					navigationType : "bullet", // bullet, thumb, none
					navigationArrows : "nexttobullets", // nexttobullets, solo
														// (old name
														// verticalcentered),
														// none

					navigationStyle : "navbar", // round,square,navbar,round-old,square-old,navbar-old,
												// or any from the list in the
												// docu (choose between 50+
												// different item), custom

					navigationHAlign : "center", // Vertical Align
													// top,center,bottom
					navigationVAlign : "bottom", // Horizontal Align
													// left,center,right
					navigationHOffset : 0,
					navigationVOffset : 20,

					soloArrowLeftHalign : "left",
					soloArrowLeftValign : "center",
					soloArrowLeftHOffset : 20,
					soloArrowLeftVOffset : 0,

					soloArrowRightHalign : "right",
					soloArrowRightValign : "center",
					soloArrowRightHOffset : 20,
					soloArrowRightVOffset : 0,

					touchenabled : "on", // Enable Swipe Function : on/off
					onHoverStop : "on", // Stop Banner Timet at Hover on Slide
										// on/off

					stopAtSlide : -1, // Stop Timer if Slide "x" has been
										// Reached. If stopAfterLoops set to 0,
										// then it stops already in the first
										// Loop at slide X which defined. -1
										// means do not stop at any slide.
										// stopAfterLoops has no sinn in this
										// case.
					stopAfterLoops : -1, // Stop Timer if All slides has been
											// played "x" times. IT will stop at
											// THe slide which is defined via
											// stopAtSlide:x, if set to -1 slide
											// never stop automatic

					hideCaptionAtLimit : 0, // It Defines if a caption should be
											// shown under a Screen Resolution (
											// Basod on The Width of Browser)
					hideAllCaptionAtLilmit : 0, // Hide all The Captions if
												// Width of Browser is less then
												// this value
					hideSliderAtLimit : 0, // Hide the whole slider, and stop
											// also functions if Width of
											// Browser is less than this value

					shadow : 1, // 0 = no Shadow, 1,2,3 = 3 Different Art of
								// Shadows (No Shadow in Fullwidth Version !)
					fullWidth : "off" // Turns On or Off the Fullwidth Image
										// Centering in FullWidth Modus

				});

			});

			if (is_touch_device()) {
				$(".portfolio-image").on('click', function(e) {
					$(this).find('.portfolio-hover').show();
				});
			}

			// function to check is user is on touch device
			function is_touch_device() {
				return 'ontouchstart' in window // works on most browsers
						|| 'onmsgesturechange' in window; // works on ie10
			}

			/* ================ PORTFOLIO ISOTOPE FILTER ================ */

			(function() {
				// ISOTOPE
				// cache container
				var $portfolioitems = $('#portfolioitems');
				// initialize isotope
				$portfolioitems.isotope({
					filter : '*',
					masonry : {
						columnWidth : 1,
						isResizable : true
					}
				});

				// filter items when filter link is clicked
				$('#filters a').click(
						function() {
							$('#filters li').removeClass('active');
							var selector = $(this).closest('li').addClass(
									'active').end().attr('data-filter');
							$portfolioitems.isotope({
								filter : selector
							});
							return false;
						});
			})();

			try {
				if ($(".animated")[0]) {
					$('.animated').css('opacity', '0');
				}
				$('.triggerAnimation').waypoint(function() {
					var animation = $(this).attr('data-animate');
					$(this).css('opacity', '');
					$(this).addClass("animated " + animation);

				}, {
					offset : '80%',
					triggerOnce : true
				});
			} catch (err) {

			}

			var wow = new WOW({
				boxClass : 'wow', // animated element css class (default is
									// wow)
				animateClass : 'animated', // animation css class (default is
											// animated)
				offset : 150, // distance to the element when triggering the
								// animation (default is 0)
				mobile : false
			// trigger animations on mobile devices (true is default)
			});
			wow.init();
			// color box

			// color
			$('#style-selector').animate({
				left : '-213px'
			});

			$('#style-selector a.close').click(function(e) {
				e.preventDefault();
				var div = $('#style-selector');
				if (div.css('left') === '-213px') {
					$('#style-selector').animate({
						left : '0'
					});
					$(this).removeClass('icon-angle-left');
					$(this).addClass('icon-angle-right');
				} else {
					$('#style-selector').animate({
						left : '-213px'
					});
					$(this).removeClass('icon-angle-right');
					$(this).addClass('icon-angle-left');
				}
			});
		});